package com.zp.crm.service.DdService.Impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.zp.crm.dao.DdDao.DdDao;
import com.zp.crm.dto.Dd.DdDto;
import com.zp.crm.entity.DdEntity.DdEntity;
import com.zp.crm.service.DdService.DdService;
import com.zp.crm.util.targetLog.Log;
@Service("ddService")
public class DdServiceImpl implements DdService {
	@Resource
	public DdDao ddDao;
	@Log(name="根据客户编号查询订单")
	@Override
	public Map<String, Object> selectCode(int page, int size, String code) {
		int count=ddDao.selectCount(code);
		List<DdEntity> list=ddDao.selectCode(code);
		String html=new DdDto().LSHtml(count,list,page,0);
		Map<String, Object> map=new HashMap<>();
		map.put("message", html);
		return map;
	}
	@Log(name="客户订单添加 ")
	@Override
	public Map<String, Object> insert(DdEntity entity) {
		Map<String, Object> map=new HashMap<>();
		
		int r=ddDao.insert(entity);
		
		if(r>0){
			map.put("success", true);
			map.put("message", "操作成功！");
		}else{
			map.put("success", false);
			map.put("message", "操作失败！");
		}	
		return map;
	}

}
